package com.wlr.study.leetcode;

/**
 * 爬楼梯
 *
 * @author HustleLr
 * @version 1.0.0
 * @date 2024/1/17 11:00
 * @describe LeetCode70
 */
public class LeetCode70 {
    public int climbStairs(int n) {
        if (n <= 1) {
            return 1;
        }
        int pre = 0, curr = 0, res = 1;
        for (int i = 1; i <= n; ++i) {
            pre = curr;
            curr = res;
            res = pre + curr;
        }
        return res;
    }

    public static void main(String[] args) {

    }
}
